babl: add a test iteration multiplier
authorØyvind Kolås <pippin@gimp.org>
Wed, 17 Jan 2018 02:57:23 +0000 (03:57 +0100)
committerØyvind Kolås <pippin@gimp.org>
Wed, 17 Jan 2018 02:59:09 +0000 (03:59 +0100)
On my system many of the conversions got measured to costs of 3 4 and 5, these
makes a big room for measurement errors, to increase reliability the tests are
now run 4 times - making it a ranking of contenders with fewer collisions.

This will slightly increase incurred delayed on search for conversions.

babl/babl-fish-path.c

index eb10fe9fcf597a0885c9ccf7e435534ba2b8d6da..d387fa89296909fd147a5a6ff41bf0a2839ed24f 100644 (file)
@@ -26,6 +26,8 @@
 #define BABL_HARD_MAX_PATH_LENGTH  8
 #define BABL_MAX_NAME_LEN          1024
 
+#define BABL_TEST_ITER             4
+
 #ifndef MIN
 #define MIN(a, b) (((a) > (b)) ? (b) : (a))
 #endif
@@ -926,7 +928,7 @@ init_path_instrumentation (FishPathInstrumentation *fpi,
                  fpi->source, fpi->ref_destination,
                  fpi->num_test_pixels);
   ticks_end = babl_ticks ();
-  fpi->reference_cost = ticks_end - ticks_start;
+  fpi->reference_cost = (ticks_end - ticks_start) * BABL_TEST_ITER;
 
   /* transform the reference destination buffer to RGBA */
   _babl_process (fpi->fish_destination_to_rgba,
@@ -1002,6 +1004,7 @@ get_path_instrumentation (FishPathInstrumentation *fpi,
 
   /* calculate this path's view of what the result should be */
   ticks_start = babl_ticks ();
+  for (int i = 0; i < BABL_TEST_ITER; i ++)
   process_conversion_path (path, fpi->source, source_bpp, fpi->destination,
                            dest_bpp, fpi->num_test_pixels);
   ticks_end = babl_ticks ();